// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//


#pragma once

#include <pollux/type/type.h>

namespace kumo::pollux::substrait {
    class PolluxSubstraitSignature {
    public:
        /// Given a pollux type kind, return the Substrait type signature, throw if no
        /// match found, Substrait signature used in the function extension
        /// declaration is a combination of the name of the function along with a list
        /// of input argument types.The format is as follows : <function
        /// name>:<short_arg_type0>_<short_arg_type1>_..._<short_arg_typeN> for more
        /// detail information about the argument type please refer to link
        /// https://substrait.io/extensions/#function-signature-compound-names.
        static std::string toSubstraitSignature(const TypePtr &type);

        /// Given a substrait type signature, return the Pollux type.
        static TypePtr fromSubstraitSignature(const std::string &signature);

        /// Given a pollux scalar function name and argument types, return the
        /// substrait function signature.
        static std::string toSubstraitSignature(
            const std::string &functionName,
            const std::vector<TypePtr> &arguments);
    };
} // namespace kumo::pollux::substrait
